from fastapi import FastAPI
from langchain_openai import ChatOpenAI
from src.settings import settings

def startup_langchain(app: FastAPI) -> None:
    app.state.langchain_llm = ChatOpenAI(
        base_url=settings.llm_base_url,
        api_key=settings.llm_api_key,
        model_name=settings.llm_model_name,
    )


def shutdown_langchain(app: FastAPI) -> None:
    app.state.langchain_llm = None